import React, { Component } from 'react';
import { connect } from 'dva';
import router from 'umi/router';
import { PageLoading } from '@ant-design/pro-layout';

class index extends Component {

  render() {
    const { subSystems } = this.props;
    if(!subSystems || subSystems.length == 0) {
      return <PageLoading/>;
    }
    const path = ((subSystems[0].modules.length < 2)?'/subSystem1/':'/subSystem/') + subSystems[0].$handle;
    router.push(path);
    return false;
  }
}

export default connect(({ tlsWebServer }) => ({
  ...tlsWebServer,
}))(index);
